<?php

namespace App\Http\Controllers\admin;

use App\Dao\TaskDao;
use App\Services\Code;

class TaskController extends BaseController
{

    public function lists(){
        if(getIsHasPage()){
            return  Code::message('',200,TaskDao::get_task_page(request()->all()));
        }
        return view('admin.task.lists');
    }


    public function add(){
        if(isPost()){
            $params = request()->all();
            TaskDao::add($params);
            return Code::message('',200);
        }
        return view('admin.task.add');
    }


    public function edit(){
        if(isPost()){
            $params = request()->all();
            TaskDao::update($params);
            return Code::message('',200);
        }
        $info = TaskDao::get_task_one(request()->all());
        return view('admin.task.edit',[
            'info'=>$info
        ]);
    }


}
